//------------------------------------------------------- //Variable Items //------------------------------------------------------- var HighlightedMenuItem = 'Menu1'; var HighlightedMenuLevel = 0; var MenuHighlightLevel1='Menu1'; var MenuHighlightLevel2=''; var MenuHighlightLevel3=''; var MenuHighlightLevel4=''; var SubMenuVisible = new Array(); var SubMenuVisibleLevel = new Array(); var OldMenuItem; var BGColorNormal='#F9F8F7'; var BGColorFocus='#E9E9E9'; var BGColorTopNormal='#d4d0c8' var BGColorTopFocus='#E9E9E9' var TimerID=null; var MainMenuHTML=''; var SubMenuHTML=''; var TopOffset=0; var LeftOffest=0; var MenuVisible=false; function ClearTimer() { if (TimerID) clearTimeout(TimerID); } function DisplayMenus() { for(var i in document.all){ if (document.all[i].tagName == 'BODY') { MenuBodyRef = document.all[i]; MenuBodyRef.insertAdjacentHTML('BeforeEnd',MainMenuHTML + SubMenuHTML); MainMenuHTML=""; SubMenuHTML=""; MenuVisible=true; break } } } function CreateDivider() { SubMenuHTML=SubMenuHTML+'' } function CreateMainMenuItem(id,imageid,imagesrc) { MainMenuHTML=MainMenuHTML + '\n'; } function FinishMainMenu() { MainMenuHTML='
\n\n\n' + MainMenuHTML + '\n
\n
\n'; } function CreateSubMenuItem(id,level,url,text,action) { if (action=="h") { SubMenuHTML=SubMenuHTML + '\n'; SubMenuHTML=SubMenuHTML + '\n' } else { SubMenuHTML=SubMenuHTML + '\n'; SubMenuHTML=SubMenuHTML + '\n' } if (url!=null) { SubMenuHTML=SubMenuHTML+'' + text + '\n' } else { SubMenuHTML=SubMenuHTML+'' + text + '\n' } if (action=="s") { SubMenuHTML=SubMenuHTML + '\n' } else { SubMenuHTML=SubMenuHTML + '\n' } SubMenuHTML=SubMenuHTML + '\n' } function StartSubMenu(id,level,left,top,scrolling) { if (level==2) { if (scrolling=='Y') { SubMenuHTML = SubMenuHTML + '' } function StartKillTimer() { if (TimerID) clearTimeout(TimerID); TimerID = null; TimerID = setTimeout("KillAllSubMenus()",500); } //--------------------------------------------------------------- // Remove Item from Visible Menu array //--------------------------------------------------------------- function RemoveArrayItem(ItemString) { for (i = 0; i < SubMenuVisible.length; i++) { if (SubMenuVisible[i]==ItemString) { var MenuItemToRemove=document.all[SubMenuVisible[i]] SubMenuVisible[i]='zzzzz' + SubMenuVisible[i] SubMenuVisibleLevel[i]='zzzzz' + SubMenuVisibleLevel[i] SubMenuVisible.sort() SubMenuVisibleLevel.sort() SubMenuVisible.length=SubMenuVisible.length-1 SubMenuVisibleLevel.length=SubMenuVisibleLevel.length-1 } } } //------------------------------------------------------- //Highlight the menu row that the mouse is currently over //------------------------------------------------------- function HighlightMenuItem(MenuItem,MenuLevel) { var MenuItemToSelect = document.all[MenuItem] var MenuItemToDeselect = document.all[HighlightedMenuItem] if (TimerID) clearTimeout(TimerID); if (HighlightedMenuLevel==2&MenuLevel==1 & MenuHighlightLevel1!='') { var Menu1 = document.all[MenuHighlightLevel1]; Menu1.style.backgroundColor=BGColorTopNormal; var PicToShow=document.all[MenuHighlightLevel1+'Pic']; if (PicToShow.src.indexOf('On.gif')!=-1) { PicToShow.src=PicToShow.src.replace('On.gif','.gif'); } MenuHighlightLevel1=''; } if (HighlightedMenuLevel==3&MenuLevel==2 & MenuHighlightLevel2!='') { var Menu1 = document.all[MenuHighlightLevel2]; Menu1.style.backgroundColor=BGColorNormal; MenuHighlightLevel2=''; } KillSubMenusOnLevel(MenuLevel); if (MenuLevel==1) { KillSubMenusOnLevel(2) KillSubMenusOnLevel(3) KillSubMenusOnLevel(4) } //Check if the item is not already highlighted if (MenuItem!=null) { if (MenuItemToDeselect!=null) { if(MenuItemToDeselect.style.backgroundColor==BGColorTopNormal||MenuItemToDeselect.style.backgroundColor==BGColorTopFocus) { MenuItemToDeselect.style.backgroundColor=BGColorTopNormal; var PicToShow=document.all[MenuItemToDeselect.id+'Pic']; if (PicToShow.src.indexOf('On.gif')!=-1) { PicToShow.src=PicToShow.src.replace('On.gif','.gif'); } } else { MenuItemToDeselect.style.backgroundColor=BGColorNormal; } } if (MenuLevel==1) { MenuItemToSelect.style.backgroundColor=BGColorTopFocus; var PicToShow=document.all[MenuItemToSelect.id+'Pic']; if (PicToShow.src.indexOf('On.gif')==-1) { PicToShow.src=PicToShow.src.replace('.gif','On.gif'); } } else { MenuItemToSelect.style.backgroundColor=BGColorFocus; } HighlightedMenuItem=MenuItem; HighlightedMenuLevel=MenuLevel; if (MenuHighlightLevel1!='') { var Menu1 = document.all[MenuHighlightLevel1]; var PicToShow=document.all[MenuHighlightLevel1+'Pic']; if (PicToShow.src.indexOf('On.gif')==-1) { PicToShow.src=PicToShow.src.replace('.gif','On.gif'); } Menu1.style.backgroundColor=BGColorTopFocus; } if (MenuHighlightLevel2!='') { var Menu2 = document.all[MenuHighlightLevel2]; Menu2.style.backgroundColor=BGColorFocus; } } } //------------------------------------------------------- //Hide all SubMenus that shouldn't be around //------------------------------------------------------- function KillSubMenusOnLevel(MenuLevel) { if (MenuLevel==1) { MenuHighlightLevel1=""; } if (MenuLevel==2) { MenuHighlightLevel2=""; } if (MenuLevel==3) { MenuHighlightLevel3=""; } if (MenuLevel==4) { MenuHighlightLevel4=""; } for (i = 0; i < SubMenuVisible.length; i++) { if (SubMenuVisibleLevel[i]==MenuLevel) { var SubMenuToHide = document.all[SubMenuVisible[i]]; SubMenuToHide.style.visibility='hidden'; RemoveArrayItem(SubMenuVisible[i]); } } } //------------------------------------------------------- //Kill all SubMenus //------------------------------------------------------- function KillAllSubMenus() { if (MenuVisible==true) { if (MenuHighlightLevel1!='') { var SelectedMenu = document.all[MenuHighlightLevel1]; SelectedMenu.style.backgroundColor=BGColorTopNormal; var PicToShow=document.all[MenuHighlightLevel1+'Pic']; if (PicToShow.src.indexOf('On.gif')!=-1) { PicToShow.src=PicToShow.src.replace('On.gif','.gif'); } KillSubMenusOnLevel(1); MenuHighlightLevel1=''; } if (MenuHighlightLevel2!='') { var SelectedMenu = document.all[MenuHighlightLevel2]; SelectedMenu.style.backgroundColor=BGColorNormal; KillSubMenusOnLevel(2); MenuHighlightLevel2=''; } if (MenuHighlightLevel3!='') { var SelectedMenu = document.all[MenuHighlightLevel3]; SelectedMenu.style.backgroundColor=BGColorNormal; KillSubMenusOnLevel(3); MenuHighlightLevel3=''; } if (MenuHighlightLevel4!='') { var SelectedMenu = document.all[MenuHighlightLevel4]; SelectedMenu.style.backgroundColor=BGColorNormal; KillSubMenusOnLevel(4); MenuHighlightLevel4=''; } } } //------------------------------------------------------- //Hide all SubMenus that shouldn't be around //------------------------------------------------------- function KillSubMenus(MenuItem) { for (i = 0; i < SubMenuVisible.length; i++) { if ((SubMenuVisible[i]!=MenuItem & SubMenuVisible[i].indexOf(MenuItem)!=-1)) { var SubMenuToHide = document.all[SubMenuVisible[i]]; SubMenuToHide.style.visibility='hidden'; if (MenuItem==MenuHighlightLevel1) { MenuHighlightLevel1="" } if (MenuItem==MenuHighlightLevel2) { MenuHighlightLevel2="" } if (MenuItem==MenuHighlightLevel3) { MenuHighlightLevel3="" } if (MenuItem==MenuHighlightLevel4) { MenuHighlightLevel4="" } if (SubMenuVisible[i]!=null) { RemoveArrayItem(SubMenuVisible[i]); } } } } //------------------------------------------------------- //Display valid SubMenus //------------------------------------------------------- function ShowMenu(SubMenuItem,MenuItem,MenuLevel) { if (MenuLevel==1 & MenuHighlightLevel1!='') { var Menu1 = document.all[MenuHighlightLevel1]; Menu1.style.backgroundColor=BGColorTopNormal; var PicToShow=document.all[MenuHighlightLevel1+'Pic']; if (PicToShow.src.indexOf('On.gif')!=-1) { PicToShow.src=PicToShow.src.replace('On.gif','.gif'); } MenuHighlightLevel1=''; } if (MenuHighlightLevel2!='') { var Menu2 = document.all[MenuHighlightLevel2]; Menu2.style.backgroundColor=BGColorNormal; MenuHighlightLevel2=''; } if (MenuLevel==1) { KillSubMenusOnLevel(2) KillSubMenusOnLevel(3) KillSubMenusOnLevel(4) } if (HighlightedMenuLevel==3&MenuLevel==2 & MenuHighlightLevel2!='') { var Menu1 = document.all[MenuHighlightLevel2]; Menu1.style.backgroundColor=BGColorNormal; MenuHighlightLevel2=''; } if (HighlightedMenuLevel==2&MenuLevel==1) { if (MenuHighlightLevel1!='') { var Menu1 = document.all[MenuHighlightLevel1]; Menu1.style.backgroundColor=BGColorTopNormal; var PicToShow=document.all[MenuHighlightLevel1+'Pic']; if (PicToShow.src.indexOf('On.gif')!=-1) { PicToShow.src=PicToShow.src.replace('On.gif','.gif'); } MenuHighlightLevel1=''; } } KillSubMenusOnLevel(MenuLevel); HighlightMenuItem(MenuItem,MenuLevel); KillSubMenus(HighlightedMenuItem); var SubMenuToShow=document.all[SubMenuItem] if (MenuLevel==1) { MenuHighlightLevel1=MenuItem; } if (MenuLevel==2) { MenuHighlightLevel2=MenuItem; } SubMenuToShow.style.visibility="visible"; SubMenuVisible[SubMenuVisible.length]=SubMenuToShow.id; SubMenuVisibleLevel[SubMenuVisibleLevel.length]=MenuLevel; }